package com.xs.bean;

public class UserBean {
	private int id;
	private String userName;
	private int age;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public UserBean(int id) {
		super();
		this.id = id;
		System.out.println("调用有参构造函数创建对象");
	}

	public UserBean(int id, String userName, int age) {
		super();
		this.id = id;
		this.userName = userName;
		this.age = age;
		System.out.println("调用有参构造函数创建对象");
	}

	public UserBean() {
		super();
		System.out.println("调用无参构造函数创建对象");
	}

	// 工厂方法-思考这里为什么要用static ?
	public static UserBean test() {
		System.out.println("调用工厂方法");

		return new UserBean(1, "zhangsan", 20);
	}
}
